import { useState } from 'react';
import { message, ModalProps } from 'antd';
import Modals from '@/components/modals/Modals.tsx';
import TagInput from '@/components/inputs/TagInput';

interface Props extends ModalProps {
  open: boolean;
  onOk: (value: any) => void;
  onCancel: () => void;
}

const CreateModal = ({ open = true, onOk, onCancel, ...props }: Props) => {
  const [value, setValue] = useState<string[]>([]);
  const onSubmit = () => {
    if (value.length === 0) {
      message.error('请输入文档类型');
      return;
    }
    onOk(value);
  };

  return (
    <Modals
      {...props}
      title={'新增文档类型'}
      open={open}
      onOk={onSubmit}
      onCancel={onCancel}
      destroyOnClose
    >
      {/* <TextArea
        placeholder="输入文档类型，多个文档类型请使用顿号（、）隔开"
        className="!border-0 !bg-[#F8F8FB] !py-3 !pl-4 !text-base"
        autoSize={{ minRows: 8, maxRows: 8 }}
        onChange={(e) => setValue(e.target.value)}
      /> */}
      <TagInput onChange={(e) => setValue(e)} defaultTags={[]} maxLength={20} />
    </Modals>
  );
};

export default CreateModal;
